package com.ygqh.baby.utils;

import java.io.IOException;

/**
 * @Author: sunshuo
 * @Date: 2019/3/18 16:06
 * @Version: 1.0
 */
public class Base64Util {

	private final static CharacterDecoder DECODER = new BASE64Decoder();
	private final static CharacterEncoder ENCODER = new BASE64Encoder();

	public static String encode(byte[] data) {
		return ENCODER.encode(data);
	}

	public static byte[] decode(String text) {
		try {
			return DECODER.decodeBuffer(text);
		} catch (IOException e) {
			e.printStackTrace();
		}
		return new byte[0];
	}
}
